package com.maybach.core.manager.impl;

import com.maybach.common.model.UserMsgDO;
import com.maybach.common.query.UserMsgQuery;
import com.maybach.core.dal.mapper.ext.UserMsgExtMapper;
import com.maybach.core.manager.UserMsgManager;
import com.maybach.util.query.support.PageResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for UserMsg.
 */

@Component
public class UserMsgManagerImpl implements UserMsgManager{
    protected Logger log = LoggerFactory.getLogger(this.getClass());

    
    @Autowired
    protected UserMsgExtMapper userMsgExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(UserMsgQuery query){
        return userMsgExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(UserMsgQuery query){
        return userMsgExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(UserMsgDO record){
        return userMsgExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(UserMsgDO record){
        return userMsgExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<UserMsgDO> selectByQuery(UserMsgQuery query){
        return userMsgExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<UserMsgDO> selectByQueryWithPage(UserMsgQuery query) {
        PageResult<UserMsgDO> result = new PageResult<UserMsgDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public UserMsgDO selectByPrimaryKey(Long id){
        return userMsgExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( UserMsgDO record,  UserMsgQuery query){
        return userMsgExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( UserMsgDO record,  UserMsgQuery query){

        return userMsgExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(UserMsgDO record){
        return userMsgExtMapper.updateByPrimaryKeySelective(record);
    }
}